package com.example.tjremark.task;


import com.example.tjremark.service.ILikedRecordService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
@Slf4j
@RequiredArgsConstructor
public class LikeTimesCheckTask {

    private static final List<String> Biz_TYPES = List.of("QA", "NOTE");
    private static final int MAX_BIZ_SIZE = 30;
    private final ILikedRecordService likedRecordService;

    @Scheduled(fixedDelay = 20000)
    public void checkLikeTimes() {
        log.info("checkLikeTimes....");
        for (String biz_type : Biz_TYPES) {
            likedRecordService.readLikedTimesAndSendMessage(biz_type, MAX_BIZ_SIZE);
        }
    }
}
